import 'dart:convert' show json;

T asT<T>(dynamic value) {
  if (value is T) {
    return value;
  }
  return null;
}


class RespLogin {
  RespLogin({
    this.id,
    this.user_type,
    this.sex,
    this.birthday,
    this.last_login_time,
    this.score,
    this.coin,
    this.balance,
    this.create_time,
    this.user_status,
    this.user_login,
    this.user_pass,
    this.user_nickname,
    this.user_email,
    this.user_url,
    this.avatar,
    this.signature,
    this.last_login_ip,
    this.user_activation_key,
    this.mobile,
    this.more,
    this.registration_id,
    this.open_id,
    this.union_id,
    this.district_id,
    this.agent_id,
    this.wx_openid,
    this.location,
    this.token,
    this.role,
    this.role_name,
    this.role_id,
    this.wall_ids,
    this.agent_info,
    this.recycler_agent_user_id,
  });


  factory RespLogin.fromJson(Map<String, dynamic> jsonRes)=>jsonRes == null? null:RespLogin(id : asT<int>(jsonRes['id']),
    user_type : asT<int>(jsonRes['user_type']),
    sex : asT<int>(jsonRes['sex']),
    birthday : asT<int>(jsonRes['birthday']),
    last_login_time : asT<int>(jsonRes['last_login_time']),
    score : asT<int>(jsonRes['score']),
    coin : asT<int>(jsonRes['coin']),
    balance : asT<String>(jsonRes['balance']),
    create_time : asT<int>(jsonRes['create_time']),
    user_status : asT<int>(jsonRes['user_status']),
    user_login : asT<String>(jsonRes['user_login']),
    user_pass : asT<String>(jsonRes['user_pass']),
    user_nickname : asT<String>(jsonRes['user_nickname']),
    user_email : asT<String>(jsonRes['user_email']),
    user_url : asT<String>(jsonRes['user_url']),
    avatar : asT<String>(jsonRes['avatar']),
    signature : asT<String>(jsonRes['signature']),
    last_login_ip : asT<String>(jsonRes['last_login_ip']),
    user_activation_key : asT<String>(jsonRes['user_activation_key']),
    mobile : asT<String>(jsonRes['mobile']),
    more : asT<Object>(jsonRes['more']),
    registration_id : asT<String>(jsonRes['registration_id']),
    open_id : asT<String>(jsonRes['open_id']),
    union_id : asT<String>(jsonRes['union_id']),
    district_id : asT<int>(jsonRes['district_id']),
    agent_id : asT<int>(jsonRes['agent_id']),
    wx_openid : asT<String>(jsonRes['wx_openid']),
    location : asT<String>(jsonRes['location']),
    token : asT<String>(jsonRes['token']),
    role : Role.fromJson(asT<Map<String, dynamic>>(jsonRes['role'])),
    role_name : asT<String>(jsonRes['role_name']),
    role_id : asT<int>(jsonRes['role_id']),
    wall_ids : asT<String>(jsonRes['wall_ids']),
    agent_info : Agent_info.fromJson(asT<Map<String, dynamic>>(jsonRes['agent_info'])),
    recycler_agent_user_id : asT<int>(jsonRes['recycler_agent_user_id']),
  );

  int id;
  int user_type;
  int sex;
  int birthday;
  int last_login_time;
  int score;
  int coin;
  String balance;
  int create_time;
  int user_status;
  String user_login;
  String user_pass;
  String user_nickname;
  String user_email;
  String user_url;
  String avatar;
  String signature;
  String last_login_ip;
  String user_activation_key;
  String mobile;
  Object more;
  String registration_id;
  String open_id;
  String union_id;
  int district_id;
  int agent_id;
  String wx_openid;
  String location;
  String token;
  Role role;
  String role_name;
  int role_id;
  String wall_ids;
  Agent_info agent_info;
  int recycler_agent_user_id;

  Map<String, dynamic> toJson() => <String, dynamic>{
    'id': id,
    'user_type': user_type,
    'sex': sex,
    'birthday': birthday,
    'last_login_time': last_login_time,
    'score': score,
    'coin': coin,
    'balance': balance,
    'create_time': create_time,
    'user_status': user_status,
    'user_login': user_login,
    'user_pass': user_pass,
    'user_nickname': user_nickname,
    'user_email': user_email,
    'user_url': user_url,
    'avatar': avatar,
    'signature': signature,
    'last_login_ip': last_login_ip,
    'user_activation_key': user_activation_key,
    'mobile': mobile,
    'more': more,
    'registration_id': registration_id,
    'open_id': open_id,
    'union_id': union_id,
    'district_id': district_id,
    'agent_id': agent_id,
    'wx_openid': wx_openid,
    'location': location,
    'token': token,
    'role': role,
    'role_name': role_name,
    'role_id': role_id,
    'wall_ids': wall_ids,
    'agent_info': agent_info,
    'recycler_agent_user_id':recycler_agent_user_id
  };

  @override
  String  toString() {
    return json.encode(this);
  }
}
class Role {
  Role({
    this.id,
    this.parent_id,
    this.status,
    this.create_time,
    this.update_time,
    this.list_order,
    this.name,
    this.remark,
  });


  factory Role.fromJson(Map<String, dynamic> jsonRes)=>jsonRes == null? null:Role(id : asT<int>(jsonRes['id']),
    parent_id : asT<int>(jsonRes['parent_id']),
    status : asT<int>(jsonRes['status']),
    create_time : asT<int>(jsonRes['create_time']),
    update_time : asT<int>(jsonRes['update_time']),
    list_order : asT<int>(jsonRes['list_order']),
    name : asT<String>(jsonRes['name']),
    remark : asT<String>(jsonRes['remark']),
  );

  int id;
  int parent_id;
  int status;
  int create_time;
  int update_time;
  int list_order;
  String name;
  String remark;

  Map<String, dynamic> toJson() => <String, dynamic>{
    'id': id,
    'parent_id': parent_id,
    'status': status,
    'create_time': create_time,
    'update_time': update_time,
    'list_order': list_order,
    'name': name,
    'remark': remark,
  };

  @override
  String  toString() {
    return json.encode(this);
  }
}

class Agent_info {
  Agent_info({
    this.id,
    this.user_id,
    this.realname,
    this.is_verify,
    this.verify_admin_id,
    this.verify_error,
    this.score,
    this.pay_type,
    this.password,
    this.score_ratio,
    this.pices,
    this.prev_agent_id,
  });


  factory Agent_info.fromJson(Map<String, dynamic> jsonRes)=>jsonRes == null? null:Agent_info(id : asT<int>(jsonRes['id']),
    user_id : asT<int>(jsonRes['user_id']),
    realname : asT<String>(jsonRes['realname']),
    is_verify : asT<int>(jsonRes['is_verify']),
    verify_admin_id : asT<int>(jsonRes['verify_admin_id']),
    verify_error : asT<String>(jsonRes['verify_error']),
    score : asT<int>(jsonRes['score']),
    pay_type : asT<int>(jsonRes['pay_type']),
    password : asT<String>(jsonRes['password']),
    score_ratio : asT<int>(jsonRes['score_ratio']),
    pices : asT<String>(jsonRes['pices']),
    prev_agent_id : asT<int>(jsonRes['prev_agent_id']),
  );

  int id;
  int user_id;
  String realname;
  int is_verify;
  int verify_admin_id;
  String verify_error;
  int score;
  int pay_type;
  String password;
  int score_ratio;
  String pices;
  int prev_agent_id;

  Map<String, dynamic> toJson() => <String, dynamic>{
    'id': id,
    'user_id': user_id,
    'realname': realname,
    'is_verify': is_verify,
    'verify_admin_id': verify_admin_id,
    'verify_error': verify_error,
    'score': score,
    'pay_type': pay_type,
    'password': password,
    'score_ratio': score_ratio,
    'pices': pices,
    'prev_agent_id': prev_agent_id,
  };

  @override
  String  toString() {
    return json.encode(this);
  }
}


